package com.firebird.app.fejpsl.ui.activity.sword.top;

import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import com.firebird.app.fejpsl.R;
import com.firebird.app.fejpsl.base.BaseTbActivity;
import com.firebird.app.fejpsl.ui.fragment.sword.top.TopCardFragment;
import com.firebird.app.fejpsl.utils.ViewFindUtils;
import com.flyco.tablayout.SegmentTabLayout;

import java.util.ArrayList;

public class EvaluationTopActivity extends BaseTbActivity {
    private ArrayList<Fragment> mFragments = new ArrayList<>();
    private String[] mTitles = {"好友", "世界"};
    private View mDecorView;
    private SegmentTabLayout mTabLayout;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sword_top_evaluation_top);
        initView();

    }
    private void initView(){
        Resources r=this.getResources();
        Drawable drawable=r.getDrawable(R.drawable.back);
        drawable.setBounds(0, 0, 120, 120);
        View view= LayoutInflater.from(this).inflate(R.layout.layout_toolbar,null);
        TextView tv_back=(TextView)findViewById(R.id.tv_back);
        tv_back.setCompoundDrawables(drawable, null, null, null);
        setBack();
        String titleName = r.getString(R.string.evaluation_top);
        setTitle(titleName);

        for (String title : mTitles) {
            mFragments.add(TopCardFragment.getInstance(title));
        }
        mDecorView = getWindow().getDecorView();
        mTabLayout = ViewFindUtils.find(mDecorView, R.id.tl_change);
        mTabLayout.setTabData(mTitles, this, R.id.fl_change, mFragments);
    }
}
